using System;
using System.Diagnostics;

namespace IBNet
{
   [DebuggerDisplay("{contract.FullSymbol, nq} {order.OrderType} {orderState.OrderStatus}, OrderId: {order.OrderId}")]
   public class OpenOrderEventArgs : EventArgs
   {
      private readonly Contract contract;
      private readonly Order order;
      private readonly OrderState orderState;

      /// <summary>
      /// Creates a new OpenOrderEventArgs.
      /// </summary>
      /// <param name="order">An Order.</param>
      /// <param name="contract">A Contract.</param>
      /// <param name="orderState">An OrderState.</param>
      public OpenOrderEventArgs(Order order, Contract contract, OrderState orderState)
      {
         this.order = order;
         this.contract = contract;
         this.orderState = orderState;
      }

      /// <summary>
      /// Gets the Order.
      /// </summary>
      public Order Order
      {
         get { return order; }
      }

      /// <summary>
      /// Gets the order Id.
      /// </summary>
      public int OrderId
      {
         get { return order.OrderId; }
      }

      /// <summary>
      /// Gets the Contract.
      /// </summary>
      public Contract Contract
      {
         get { return contract; }
      }

      /// <summary>
      /// Gets the OrderState.
      /// </summary>
      public OrderState OrderState
      {
         get { return orderState; }
      }

      public override string ToString()
      {
         string representation = "OpenOrderEventArgs: FullSymbol: " + contract.FullSymbol +
            ", OrderType: " + order.OrderType + ", OrderStatus: " + orderState.OrderStatus +
            ", OrderId: " + order.OrderId;
         return representation;
      }
   }
}